{{define "index/index.html"}}

<!DOCTYPE html>
<html>

<head>
  {{template "layout/head.html" .}}
</head>

<body>
  <div class="wrapper">

    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand navbar-dark navbar-navy">
      <!-- Left navbar links -->
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fa fa-bars"></i></a>
        </li>

      </ul>




      <!-- Right navbar links -->
      <ul class="navbar-nav ml-auto">
        
        <li class="nav-item user-menu">
          <a class="nav-link" data-toggle="dropdown" href="#" aria-expanded="false">
            <img src="{{.userInfo.HeadPortrait}}" class="user-image" alt="User Image">
            <span class="badge ">{{.userInfo.Alias}}</span>
          </a>
          <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
            <!-- User image -->
            <li class="user-header">
              <img src="{{.userInfo.HeadPortrait}}" class="img-circle user-image" alt="User Image">
              <p>
                {{.userInfo.Alias}}
                <small>Member since Nov. 2012</small>
              </p>
            </li>
            <!-- Menu Footer-->
            <li class="user-footer">
              <div class="pull-left">
                <a href="#" class="btn btn-default btn-flat modifyPwdBtn">修改密码</a>
              </div>              
              <div class="pull-left" style="margin-left: 20px;display: none;">
                <a href="#" class="btn btn-default btn-flat modifyPhotoBtn">修改头像</a>
              </div>
              <div class="pull-right">
                <a href="#" class="btn btn-default btn-flat logoutBtn">退出</a>
              </div>
            </li>
          </ul>
        </li>
        <li class="nav-item">
          <a class="nav-link" data-widget="fullscreen" href="#" role="button">
            <i class="fa fa-expand-arrows-alt"></i>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
            <i class="fa fa-th-large"></i>
          </a>
        </li>
      </ul>
    </nav>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <aside class="main-sidebar elevation-4 sidebar-light-navy">
      <!-- Brand Logo -->
      <a href="index3.html" class="brand-link navbar-navy">
        <img src="{{.pageContentPath}}/static/plugins/adminlte/img/AdminLTELogo.png" alt="AdminLTE Logo"
          class="brand-image img-circle elevation-3" style="opacity: .8">
        <span class="brand-text font-weight-light" style="color: white;">GoAdmin</span>
      </a>

      <!-- Sidebar -->
      <div
        class="sidebar os-host os-theme-light os-host-overflow os-host-overflow-y os-host-resize-disabled os-host-scrollbar-horizontal-hidden os-host-transition">
         <!-- Sidebar user panel (optional) -->
        <div class="user-panel mt-3 pb-3 mb-3 d-flex">
          <div class="image">
            <img src="{{.userInfo.HeadPortrait}}" class="img-circle elevation-2" alt="User Image">
          </div>
          <div class="info">
            <a href="#" class="d-block">{{.userInfo.Alias}}</a>
          </div>
        </div>
        
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" id="MAIN_NAVIGATION_MENU" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
          
          <li class="nav-header">导航菜单</li>

         
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
      </div>
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper iframe-mode" data-widget="iframe" data-loading-screen="750">
      <div class="nav navbar navbar-expand-lg navbar-white navbar-light border-bottom p-0">
        <a class="nav-link bg-danger" href="#" data-widget="iframe-close">Close</a>
        <a class="nav-link bg-light" href="#" data-widget="iframe-scrollleft"><i class="fa fa-angle-double-left"></i></a>
        <ul class="navbar-nav" role="tablist"></ul>
        <a class="nav-link bg-light" href="#" data-widget="iframe-scrollright"><i class="fa fa-angle-double-right"></i></a>
        <a class="nav-link bg-light" href="#" data-widget="iframe-fullscreen"><i class="fa fa-expand"></i></a>
      </div>
      <div class="tab-content">
        <div class="tab-empty">
          <h2 class="display-5">请点击要查看的菜单项</h2>
        </div>
        <div class="tab-loading">
          <div>
            <h2 class="display-6">页面加载中 <i class="fa fa-sync fa-spin"></i></h2>
          </div>
        </div>
      </div>
    </div>
    <!-- /.content-wrapper -->

    <!-- /.content-wrapper -->
    <footer class="main-footer">
      <strong>Copyright © 2014-2020 <a href="#">GoAdmin</a>.</strong>
      All rights reserved.
      <div class="float-right d-none d-sm-inline-block">
        <b>Version</b> 1.1.0
      </div>
    </footer>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Control sidebar content goes here -->
    </aside>
    <!-- /.control-sidebar -->
    <!--修改密码提示层-->

    <div  class="pwdModifyParentDiv" style="display: none;">
      <div class="form-horizontal">
          <div class="box-body" style="min-width: 550px;">

              <div class="form-group">
                  <label for="Home_modpwd_curpwd" class="col-sm-2 control-label">当前密码</label>
                  <div class="col-sm-10">
                      <input type="password" class="form-control Home_modpwd_curpwd" placeholder="Password">
                  </div>
              </div>
              <div class="form-group">
                  <label for="Home_modpwd_newpwd" class="col-sm-2 control-label">新密码</label>
                  <div class="col-sm-10">
                      <input type="password" class="form-control Home_modpwd_newpwd" placeholder="Password">
                  </div>
              </div>
              <div class="form-group">
                  <label for="Home_modpwd_repwd" class="col-sm-2 control-label">确认密码</label>
                  <div class="col-sm-10">
                      <input type="password" class="form-control Home_modpwd_repwd" placeholder="Password">
                  </div>
              </div>
              <div class="form-group pwdModifyErrorNoteDiv" style="display: none">
                  <div class="alert alert-danger alert-dismissable">
                      <h4><i class="icon fa fa-ban"></i> Alert!</h4>
                      <span></span>
                  </div>
              </div>
          </div>
      </div>
  </div>
  </div>


  {{template "layout/foot.html" .}}

  <script src="{{.pageContentPath}}/static/plugins/CryptoJS-v4.0.0/crypto-js.js"></script>
  <script src="{{.pageContentPath}}/static/joyconn/encryptoUtils.js?v=2"></script>

  <script src="{{.staticResourcesPathJs}}/static/plugins/overlayScrollbars/js/jquery.overlayScrollbars.js"></script>
  <link rel="stylesheet" href="{{.staticResourcesPathCss}}/static/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">

  <script src="{{.staticResourcesPathJs}}/static/joyconn/joyconn_authenticate.js"></script>
  <script>
    $(function () {
      $('body').addClass("sidebar-mini layout-fixed layout-navbar-fixed layout-footer-fixed accent-navy text-sm");
      $('body').attr("data-panel-auto-height-mode","height")
      // $('.content-wrapper.iframe-mode').css("min-height","0px")
      joyconn_layout_authorize.showMenuByID(1)
      $.get(page_content_path +'/api/system/account/user/getMe',{},
                        function (data) {
                          if (!joyconn_layout.ValidataResult(data)) {
                              return;
                          }
                        }
                    );
      $('.main-header .user-footer .modifyPwdBtn').click(function(){
        var html = $('<div class="dialog_pwdMofify"></div>');
        html.append($(".pwdModifyParentDiv").html());
        var dia = JoyDialog({
            titleText: '修改密码',
            content: html.get(0),
            // width: '400px',
            buttonTextCancel:"取消",
            buttonTextConfirm: "修改",
            onClickConfirmBtn: ClickConfirmBtn
        });
        function ClickConfirmBtn(){
          var curpwd = html.find(".Home_modpwd_curpwd").val();
          var newpwd = html.find(".Home_modpwd_newpwd").val();
          var repwd = html.find(".Home_modpwd_repwd").val();
          var pwdModifyErrorNoteDiv =  html.find(".pwdModifyErrorNoteDiv");
          var errorNote= html.find(".pwdModifyErrorNoteDiv").find('span');
          if (curpwd == '') {
              $(errorNote).html('请输入当前密码');
              $(pwdModifyErrorNoteDiv).css("display","");
              return false;
          }
          if (newpwd == '') {
              $(errorNote).html('请输入新密码');
              $(pwdModifyErrorNoteDiv).css("display","");
              return false;
          }
          if (newpwd != repwd) {
              $(errorNote).html('两次密码输入的不一致');
              $(pwdModifyErrorNoteDiv).css("display","");
              return false;
          }
          $.ajax({
              url:page_content_path+ '/api/system/account/user/modifyPwd',
              type: 'post',
              data: { pwd: encryptoPwd( curpwd,'{{.ParamEncryptKey}}') , npwd:encryptoPwd(newpwd,'{{.ParamEncryptKey}}')  },
              cache: false,
              success: function (data) {
                  if(joyconn_layout.ValidataResult(data)) {
                      if (data.code == 100001) {
                          dia.close();
                          JoyDialog({
                                titleText: '修改成功',
                                content:  '密码修改成功！',
                                buttonTextCancel:false
                            });
                          return;
                      }
                      else if (data.code == 100108) {
                          $(errorNote).html('当前密码输入不正确');
                          $(pwdModifyErrorNoteDiv).css("display", "");
                      }
                      else {
                          $(errorNote).html('密码修改失败');
                          $(pwdModifyErrorNoteDiv).css("display", "");
                      }
                  }
              }
          });
          return false
            
        }
      })
      $('.main-header .user-footer .logoutBtn').click(function(){
        $.post(page_content_path+"/api/joyconn/authorize/AuthenticationApi/dologinout",{},function (data) {
           window.location.href = data.data
        })
      })
    
    })

  </script>
</body>

</html>
{{end}}